<!DOCTYPE html>
<html class="translated-ltr">
<head>
    <meta charset="UTF-8">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstsrap.style.css" rel="stylesheet">
    <link type="text/css" rel="stylesheet" charset="UTF-8"
          href="https://translate.googleapis.com/translate_static/css/translateelement.css">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.0/jquery.js"></script>
    <script type="text/javascript" src="js/payment.js"></script>
    <script type="text/javascript">

        const FINDBYNAMEUSER_URL="http://localhost:8080/mi/findByName";
        const FINDALLCART_URL="http://localhost:8080/mi/GetCart";
        const IMAGE_URL="./image/";
        let name;
        $(function () {
             name = localStorage.getItem("name");
             $("#dlname").text(name);
            //展示改用户ID下所有的购物车 <tr class="orderItemTR" >
            /**
             * 获取用户信息
             */
            $.post(FINDBYNAMEUSER_URL,{name:name},function (result) {

                $("#uphone").attr("placeholder",result.date.phone);
                $("#uname").attr("placeholder",result.date.name);
                $("#address").text(result.date.address)
            })
            let sum = sessionStorage.getItem("sum");
            $("#value_sum").text(sum);

            /**
             * 获取用户信息购车中的信息
             */
            $.post(FINDALLCART_URL,{uname:name},function (resultall) {
                console.log(resultall);
                for (const rs of resultall.date) {
                    $("#cart").append(
                        $('<tr class="orderItemTR" >').append(
                            $('<td class="orderItemFirstTD">').append(
                                $('<img class="orderItemImg">').attr("src",IMAGE_URL+rs.image)
                            )
                        ).append(
                            $('<td class="orderItemProductInfo">').append(
                                $(' <a href="foreproduct?pid=147" class="orderItemProductLink">')
                                    .text(rs.name)
                            )
                        ).append(
                            $("<td>").append(
                                $('<span class="orderItemProductPrice">').append(
                                    $('<font style="vertical-align: inherit;">').append(
                                        $('<font style="vertical-align: inherit;">').text("￥"+rs.price)
                                    )
                                )
                            )
                        ).append(
                            $("<td>").append(
                                $('<span class="orderItemProductNumber">').text(rs.value)
                            )
                        ).append(
                            $("<td>").append(
                                $('<span>').text(rs.id).attr("href",)
                            )
                        )
                    )
                      }
                 })

            $("#subpay").click(function () {


                alert("购买下所有商品");
            })


        })

    </script>
</head>

<body style="">


<nav class="top ">
    <div class="top_middle">

        <a href="/index.html">
            <span style="color:#C40000;margin:0px" class=" glyphicon glyphicon-home redColor"></span>
            小米首页
        </a>

        <span>欢迎来到小米手机专卖网</span>


        <a href="self_info.html" id="dlname">你好</a>
        <a href="index.html">退出</a>


        <span class="pull-right">
			<a href="payment.html">我的订单</a>
			<a href="gouwuche.html">
			<span style="color:#C40000;margin:0px" class=" glyphicon glyphicon-shopping-cart redColor"></span>
			购物车</a>
		</span>
    </div>
</nav>

<div class="buyPageDiv">
    <form action="forecreateOrder" method="post">

        <div class="buyFlow">
            <img class="pull-left" src="image/logo_top.png">

            <div style="clear:both"></div>
        </div>
        <div class="address">
            <div class="addressTip">确认您的收货地址</div>
            <div>
                <table class="addressTable">
                    <tbody>
                    <tr>
                        <td class="firstColumn">详细地址<span class="redStar">*</span></td>

                        <td><textarea name="address" id="address" placeholder="建议您如实填写详细收货地址，例如接到名称，门牌好吗，楼层和房间号等信息"></textarea></td>
                    </tr>
                    <tr>
                        <td>邮政编码</td>
                        <td><input name="post" placeholder="如果您不清楚邮递区号，请填写000000" type="text"></td>
                    </tr>
                    <tr>
                        <td>收货人姓名<span class="redStar">*</span></td>
                        <td><input name="receiver" id="uname" placeholder="长度不超过25个字符" type="text"></td>
                    </tr>
                    <tr>
                        <td>手机号码 <span class="redStar">*</span></td>
                        <td><input name="mobile" id="uphone" placeholder="请输入11位手机号码" type="text"></td>
                    </tr>
                    </tbody>
                </table>

            </div>


        </div>
        <div class="productList">
            <div class="productListTip">确认订单信息</div>


            <table class="productListTable">
                <thead>
                <tr>
                    <th colspan="2" class="productListTableFirstColumn">
                        <img class="tmallbuy" src="image/logo_top.png">
                        <a class="marketLink" href="#nowhere">店铺：小米店铺</a>
                        <a class="wangwanglink" href="#nowhere"> <span class="wangwangGif"></span> </a>
                    </th>
                    <th>单价</th>
                    <th>数量</th>
                    <th>小计</th>
                    <th>配送方式</th>
                </tr>
                <tr class="rowborder">
                    <td colspan="2"></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
                </thead>
                <tbody class="productListTableTbody" id="cart">

                </tr>
                </tbody>
            </table>


        </div>

        <div class="orderItemTotalSumDiv">
            <div class="pull-right">
                <span>实付款：</span>
                <span class="orderItemTotalSumSpan" id="value_sum">￥17,024.00</span>

            </div>
<!--            <img src="image/ewm.png" alt="" style= >-->
        </div>

        <div class="submitOrderDiv">
            <button type="button" class="submitOrderButton"><a href="payment_completed.html" id="subpay">提交订单</a></button>
        </div>

    </form>
</div>



<div id="footer" class="footer" style="display: block;">

    <div id="footer_desc" class="footer_desc">
        <div class="descColumn">
            <span class="descColumnTitle">购物指南</span>
            <a href="#nowhere">免费注册</a>
            <a href="#nowhere">开通支付宝</a>
            <a href="#nowhere">支付宝充值</a>
        </div>
        <div class="descColumn">
            <span class="descColumnTitle">小米保障</span>
            <a href="#nowhere">发票保障</a>
            <a href="#nowhere">售后规则</a>
            <a href="#nowhere">缺货赔付</a>
        </div>
        <div class="descColumn">
            <span class="descColumnTitle">支付方式</span>
            <a href="#nowhere">快捷支付</a>
            <a href="#nowhere">信用卡</a>
            <a href="#nowhere">蚂蚁花呗</a>
            <a href="#nowhere">货到付款</a>
        </div>
        <div class="descColumn">
            <span class="descColumnTitle">商家服务</span>
            <a href="#nowhere">商家入驻</a>
            <a href="#nowhere">商家中心</a>
            <a href="#nowhere">小米智库</a>
            <a href="#nowhere">小米规则</a>
            <a href="#nowhere">物流服务</a>
            <a href="#nowhere">小爱服务</a>
            <a href="#nowhere">运营服务</a>
        </div>
        <div class="descColumn">
            <span class="descColumnTitle">小米手机</span>
            <a href="#nowhere"><img src="image/logo_top.png"></a>
        </div>

    </div>

    <div style="clear:both"></div>


    <div id="copyright" class="copyright">
        <footer class="mt20 center" style="display: flex;justify-content: center;align-items: center;flex-direction: column;">
            <div class="mt20">小米商城|MIUI|米聊|多看书城|小米路由器|视频电话|小米天猫店|小米淘宝直营店|小米网盟|小米移动|隐私政策|Select Region</div>
            <div>©mi.com 京ICP证110507号 京ICP备10046444号 京公网安备11010802020134号 京网文[2014]0059-0009号</div>
            <div>违法和不良信息举报电话：185-0130-1238，本网站所列数据，除特殊说明，所有数据均出自我司实验室测试</div>
        </footer>

    </div>
</div>


</body>
</html>